@extends('backend.layouts.main-iframe')
@section('content')
<div class="col-md-6">
    <div class="box box-primary">
        <form class="form-horizontal" action="{{URL('admin/role/')."/".encryptionUrl($roleDatas->id)}}" method="post">
            <div class="box-body">
                {{ method_field('PUT') }}
                {{ csrf_field() }}
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputWarning">角色名称</label>
                        <input type="text" class="form-control" name="role_name" value="{{$roleDatas->role_name}}">
                        @if ($errors->has('role_name'))
                        <span class="help-block">
                            <strong style="color: #a94442;">{{ $errors->first('role_name') }}</strong>
                        </span>
                        @endif
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">角色说明</label>
                        <input type="text" class="form-control" name="role_explain" value="{{ $roleDatas->role_explain}}">
                        @if ($errors->has('role_explain'))
                        <span class="help-block">
                            <strong style="color: #a94442;">{{ $errors->first('role_explain') }}</strong>
                        </span>
                        @endif
                    </div>
                    <div class="form-group">
                        <label for="inputWarning">权限</label>
                        <div class="checkbox">
                            <?php $temp = "" ?>
                            @foreach($permissionAlls AS $permissionAll)
                            @foreach($roleDatas->getPermission as $permission)
                            @if($permission->id==$permissionAll->id)
                            <?php $temp = $permission->id ?>
                            @endif
                            @endforeach
                            <label>
                                <input type="checkbox" name="permission[]" @if($temp==$permissionAll->id) checked="checked" @endif  value="{{$permissionAll->id}}"> {{$permissionAll->permissions_name}}
                            </label>
                            @endforeach
                        </div>
                        @if ($errors->has('role'))
                        <span class="help-block">
                            <strong style="color: #a94442;">{{ $errors->first('role') }}</strong>
                        </span>
                        @endif
                    </div>
                </div>
                <div class="box-footer">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
        </form>
    </div>
</div>
</div>
@endsection